import request from "@/request/request"
import requestMock from "@/request/requestMock"


export const reqGetCategoryList = () => {
    return request.get('/product/getBaseCategoryList')
}

export const reqGetBannerList = () => {
    return requestMock.get('/bannerlist')
}

export const reqGetFloorList = () => {
    return requestMock.get('/floorlist')
}
export const reqGetSearchList = (SearchParams) => {
    return request.post('/list', SearchParams)
}
export const reqGetGoodInfo = (skuId) => {
    return request.get(`/item/${skuId}`);
}
export const regAddGoodInfo = (skuId, skuNum) => {
    return request.post(`/cart/addToCart/${skuId}/${skuNum}`)
}
export const regGetShopCartList = () => {
    return request.get('/cart/cartList')
}
export const regChangeGoodChecked = (skuID, isChecked) => {
    return request.get(`/cart/checkCart/${skuID}/${isChecked}`)
}
export const regDeleteGood = (skuId) => {
    return request.delete(`/cart/deleteCart/${skuId}`)
}
export const reqChangeAllChecked = (isChecked, skuIdList) => {
    return request.post(`/cart/batchCheckCart/${isChecked}`, skuIdList)
}
export const reqDeleteAllChecked = (skuIdList) => {
    return request.delete(`/cart/batchDeleteCart`, {
        data: {
            skuIdList
        }
    })
}

export const reqGetVerifyCode = (phone) => {
    return request.get(`/user/passport/sendCode/${phone}`)
}

export const reqRegister = (userInfo) => {
    return request.post(`/user/passport/register`, userInfo)
}

export const reqLogin = (userInfo) => {
    return request.post(`/user/passport/login`, userInfo)
}

export const reqGetUserInfo = () => {
    return request.get(`/user/passport/auth/getUserInfo`)
}
export const reqLogOut = () => {
    return request.get(`/user/passport/logout`)
}
export const reqUserAddress = () => {
    return requestMock.get(`/addressList`)
}
export const reqGetTradeInfo = () => {
    return request.get('/order/auth/trade')
}
export const reqSubmitOrder = (tradeNo, orderInfo) => {
    return request.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, orderInfo)
}
export const reqGetOrderInfo = (orderId) => {
    return request.get(`/payment/weixin/createNative/${orderId}`)
}
export const reqQueryStatus = (orderId) => {
    return request.get(`/payment/weixin/queryPayStatus/${orderId}`)
}
export const reqGetOrderList = (page, limit) => {
    return request.get(`/order/auth/${page}/${limit}`)
}